package com.gmq.chapter01.interrupt;

/**
 * Created by gmq on 2017/08/09.
 * 在沉睡中停止
 *
 * @version 1.0
 * @since 2017/08/09 14:29
 */
public class MyThread04 extends Thread {

    private int i = 0;

    /*@Override
    public void run() {
        super.run();

        try {
            while (true) {
                i++;
                System.out.println("i=" + (i + 1));
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }*/

    @Override
    public void run() {
        super.run();


        try {
            this.stop();
        } catch (ThreadDeath e) {
            System.out.println("run catch");
            e.printStackTrace();
        }
    }
}


